Known editted if:
	28364 is not a pointer
	283D0 is 0

This block can allocate up to 100 weapon sets, including random and custom

!IMPORTANT NOTE!
to re-enable left-handed weapons, do this:
37347 0x10

*_*

Ammo crate:
0x80	2	model override, shared by both values. -1 to ignore
0x82	1	ammo type +1's ammo
0x83	1	ammo type +D's ammo

handles types 1-1A.  Redirect tank to ammo F
should be backward compatible...

Annoyingly, just realized there's an ammo multiplier.
	Well, for now it will only affect solo, but maybe add in a difficulty setting for multiplayer...

0x283CF	1	minimum set number for MwtGX, to ensure compliance
0x283D0	1	# sets
0x283D1	1	# weapons (set smaller to exclude last members of list)
0x283D2	1	selected set
0x283D3	1	set in use (allows random to always remain selected, see?)

+_+

Lookup scheme:
weapons from 0-0x58
	Valid MP weapons will be entered into a table with MP data
	weapon# -1 is reserved for BA
	set 0x80 of table# for left-handed pickup (future use)
	other special gadgets can be tacked-in later

weapon set numbers bring up a list of 0x12 chars for weapon codes
basically a mirror of PAL
0x0	1	weapon
0x1	1	ammo type
0x2	1	ammo amount
0x3	1	flags:
		01	weapon pickup
		02	ammo pickups
		80	left-handed capable
0x4	2	weapon model
0x6	2	scale	0100 = 100%

	weapon code F0-FF use entries 0-F
	entries refer to MP data table entries
	negative table entry numbers indicate left-handed weapons
		mask with +3 from object to determine if left-able
	yes, this does presume we'll fix the MP doubles glitch one day...
0x0	1	F0
0x1	1	F1
0x2	1	F2
0x3	1	F3
0x4	1	F4
0x5	1	F5
0x6	1	F6
0x7	1	F7
0x8	1	F8	used by 'Man with the Golden X' scenario
0x9	1	F9
0xA	1	FA
0xB	1	FB
0xC	1	FC
0xD	1	FD
0xE	1	FE
0xF	1	FF
0x10	2	text for weapon select menu

sets reserve space from 0x27B70 - 0x28270
	sets span from 1-100
	0 is special code indicating random
0x283D0	1	total number of entries (64 max - doesn't count random entry)
0x283D2	1	selected weapon set
0x283D3 1	still indicates current weapon set

scale moding is easier now!  scale * scale / 0x100 = new scale
BA only - scale value indicates armor value, not scale.
weapon codes 80-A2 reserved for 'cheat' pickup items.
	ie: pickup gives invisibility or inf. ammo
	(if turbo was player-specific, could have a trans-am pickup!)

(_(

278E0-28360	80048670 - 800490F0	MP weapon set data

weapons:
00	Nothing	0100000000000100
01	Knives	020A0A8300BA0180
02	Hunt	0200008100BA0180
03	Knife	030A0A8200D10180
04	PP7	0401328300BF0300
05	PP7(s)	0501328300CC0180
06	DD44	0601328300CD0300
07	Klobb	0701648300C10180
08	KF7	0803648300B80180
09	ZMG	0901648300C30180
0A	D5K	0A01648300BD0100
0B	D5K(s)	0B01648300CE0100
0C	Phant.	0C01648300C20100
0D	AR33	0D03648300BC0100
0E	RC-P90	0E01648300C50100
0F	Shot.	0F041E8300C00100
10	A.Shot	10041E8300CF0100
11	Sniper	1103328300D20100
12	Magnum	120C328300BE0180
13	G.G.	130D0A8300D00180
14	S.PP7	1401328300BF0300
15	G.PP7	15010A8300BF0300
16	Laser	1600008100BB0180
17	Watch	1718960300C60080
18	G.L.	180B068300B90100
19	R.L.	1906068300D30180
1A	Gren.	1A05050200C40180
1B	Timed	1B09050200C90180
1C	Prox.	1C08050200C80180
1D	Remote	1D07050200C70180
1E	Tazer	1F00000100C60100
1F	Tank	200F050300CA0100
20	Case	2100000100E20100
21	Weap.C	2C00000100F20100
22	Magnet	4C19050300C60100
23	Flag	58000001014D0100
24	L.Armor	FF00000100740080
25	Armor	FF00000100730100
26	H.Armor	FF00000100730180
	reserved	22 entries for cheat triggering item pickups

0x27CC0	80048A50	sets 1-100
since sets are 0x12, and I don't want specialized code for random,
	sets block starts with text code for random
	actual offset then is from 80048A40, though entry 0 is forced to a random entry number

original sets:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00	A800	Slappers Only	deleting...
05 05 05 04 04 04 11 11 85 85 85 84 84 84 91 91	A801	Pistols
02 02 02 02 02 02 02 02 82 82 82 82 82 82 82 82	A80D	Throwing Knives
04 04 05 05 06 06 09 09 84 84 85 85 86 86 89 89	A802	Automatics
05 05 11 11 0D 0D 0F 0F 85 85 91 91 8D 8D 8F 8F	A803	Power Weapons
05 05 11 11 06 06 10 10 85 85 91 91 86 86 90 90	A804	Sniper Rifles
05 05 06 06 07 07 19 19 85 85 86 86 87 87 19 19	A805	Grenades
03 03 08 08 0C 0C 1C 1C 83 83 88 88 8C 8C 1C 1C	A806	Remote Mines
05 05 06 06 07 07 17 17 85 85 86 86 87 87 97 97	A807	Grenade Launchers
03 03 08 08 0C 0C 1A 1A 83 83 88 88 8C 8C 1A 1A	A808	Timed Mines
03 03 08 08 0C 0C 1B 1B 83 83 88 88 8C 8C 1B 1B	A809	Proximity Mines
05 05 06 06 07 07 18 18 85 85 86 86 87 87 98 98	A80A	Rockets
05 05 06 06 07 07 15 15 85 85 86 86 87 87 16 16	A80B	Lasers
05 05 06 06 07 07 04 12 85 85 86 86 87 87 84 23	A80C	Golden Gun

new sets!
9C9A	random
08 0A 09 05 06 0B 0C 0D 88 8A 89 85 86 8B 8C 24	[A011]	Rattle	(PaD)
0E 19 0E 1C 18 1B 17 11 8E 19 8E 1C 98 1B 23 25	[A012]	Explosives (Zoinkity)
01 81 0E 8E 0B 8B 16 13 02 82 0E 8E 19 19 24 24	A007	Mostly Harmless (Zoinkity)

)_)

routines:
7F0C65D0:	FB100	0FC31974	advance MP weapon set menu one option; saves updated value
revised to account for variable entry numbers...
	fries: AT,V0,T6,T7,T8
3C028005	LUI	V0,8005
804E9162	*LB	T6,9162 (V0)	;T6=cur selection
80419160	*LB	AT,9160 (V0)	;AT=max entries
25CE0001	ADDIU	T6,T6,0001	;T7=T6+1: set++
24210001	ADDIU	AT,AT,0001	;accounts for random entry
01C1001A	DIV	T6,AT
00007010	MFHI	T6		;T8=set % total
03E00008	JR	RA
A04E9162	*SB	T6,9162 (V0)	;save revised set number
00000000	NOP
used at:
	7F010EA8	459D8

7F0C65F8:	FB128	0FC3197E	V0= p->current weapon set's text code
	fries: T6,T7,T8
REMOVED IN HACKED ROM
LUI	T6,8005
LW	T6,9160 (T6)	;T6=80049160: selected weapon set
LUI	T8,8005
ADDIU	T8,T8,90F0	;T8=800490F0: p->weapon set text code
SLL	T7,T6,0x3	;T7=T6*8: set# -> offset
JR	RA
ADDU	V0,T7,T8	;V0=p->current weapon set's text code
used at:
	7F011A74	465A4

!REVISED!
7F0C6614:	FB144	0FC31985	V0=p->selected weapon set list; T7=weapon set #
redirected to	7F0C65F4:	FB124	0FC3197D
	fries: T6,T7
//7F0C6608	FB138	0FC31982
3C028005	LUI	V0,8005
10000006	BEQ	R0,R0,+3
904F9160	*LBU	T7,9160 (V0)	//T6=80049162: final weapon set
//7F0C65F4:	0FC3197D	selected weapon set
3C028005	LUI	V0,8005
10000003	BEQ	R0,R0,+3
904F9162	*LBU	T7,9162 (V0)	//T6=80049162: selected weapon set
//7F0C6600:	0FC31980	current weapon set
3C028005	LUI	V0,8005
904F9163	*LBU	T7,9163 (V0)	//T6=80049163: current weapon set
000F70C0	*SLL	T6,T7,0x3
01CF7021	ADDU	T6,T6,T7
000E7040	SLL	T6,T6,0x1	//T6=T7*12
004E1021	*ADDU	V0,V0,T6	//V0=
03E00008	JR	RA
24428A40	ADDIU	V0,V0,8A40	//V0=80048A40: MP set menu entries
used at:
	373A0	7F002870	08 weapon expansion
	392A4	7F004774	14 ammo crate expansion

7F0C6630:	FB160	0FC3198C	save selected set number A0
	LUI	AT,8005
	JR	RA
A0249162	*SB	A0,9162 (AT)
used at:
	4503C
	4506C
	450B4
	450E4
	45118
	F50A0

7F0C663C:	FB16C	0FC3198F	V0= selected set number
moved to:

	LUI	V0,8005
	JR	RA
80428162	LB	V0,9162 (V0)
NOP
NOP
used at:
	45020
	45058
	450A0
	F4F50

7F0C6650:	FB178	0FC31994	deleted routine...
	called at 70006798, when doing something with memory allocations...
	safe to remove the call, concidering it does nothing at all...
JR	RA
NOP


7F0693F4	9DF24	converts Fx MP weapon code to p->data
	accepts: A0=weapon code
	returns: V0=p->data, A0=data# (for lefty comparisons)
	fries:	A0,T6,T7
AFBFFFE0	SW	RA,FFE0 (SP)
0FC31980	JAL	7F0C6600	;ret V0=p->cur weapon set
3084000F	ANDI	A0,A0,000F	;A0=weapon code 0-F
00447021	ADDU	T6,A0,V0	;V0=p->weapon code in set
3C028005	LUI	V0,8005
91C40000	LBU	A0,0000 (T6)	;A0=data#
308E007F	ANDI	T6,A0,007F	;T6=unmask left hand flag
000E70C0	SLL	T6,T6,0x3	;T6=#->offset
24428670	ADDIU	V0,V0,8670	;V0=p->first MP data entry
8FBFFFE0	LW	RA,FFE0 (SP)
03E00008	JR	RA
01C21021	ADDU	V0,T6,V0	;V0=p->MP data entry
	NOP
	NOP
	
random weapon set:
if selected != 0, copy to current
otherwise:
	7000A450 returns V0=random number
	fries: AT,A0,A1,A2,V0
	DIV V0 by max entries
	MFHI to get %
	ADDIU 1 to result to get a set between 1-max
	save result

7F050A08	85538	0FC14282	copy selected set to current set slot; handles random weapon set
	fries: AT,A0,A1,A2,V0,T6,T7
3C0E8005	LUI	T6,8005
91CF9162	LBU	T7,9162 (T6)	;T7=selected
15E00006	BNEZ	T7,+6
AFBFFFE0	SW	RA,FFE0 (SP)
0C002914	JAL	7000A450
91CF9160	LBU	T7,9160 (T6)	;T8=max
004F001B	DIVU	V0,T7
00007810	MFHI	T7		;T8=set % total
25EF0001	ADDIU	T7,T7,0001
8FBFFFE0	LW	RA,FFE0 (SP)
03E00008	JR	RA
A1CF9163	SB	T7,9163 (T6)


@_@

04 keys...
7F004468 is silly.  It does the same thing as 03's expansion but redirects neeedlessly through 7F002A1C
redirect routine to STDOBJ, then fry both data segments


08 weapon hack!
use 7F0693F4: A0=weapon code, returning V0=p->weapon data + A0=# for left comparisons
	mask data# with +3 in weapon data to determine if lefty is possible
	ANDI data,0x80; AND lefty,data,wep; BNEZL +1, set lefty byte in object
if weapon = -1, this is a BA pickup
	change object type to 15
	use scale as BA pickup percentage; scale<<8
flag is allowable as a pickup type
So ammo boxes don't get weird or broken, they're going to work the same as always.
	save p->weapon data to Ammo's buffer (80069540),
	rewrite 08 weapon handler to *NOT* write -1 to this.  0 should be default,
Ammo clips look up ammo based on Fx value?

To be certain the Ammo box thing is always valid:
7F004E10	39940
3C018007	LUI	AT,8007
AC205D00	SW	R0,5D00 (AT)
AC209540	*SW	R0,9540 (AT)


7F004434:	38F64	jump that executes specific 08 object expansion
8FAF0278	LW	T7,0278 (SP)	//the infamous 'better equal 1 if you want objects'...
11E001B0	BEQ	T7,R0,7F004AFC
8E4E000C	LW	T6,000C (S2)	//upper 32 bitflags
02A02025	OR	A0,S5,R0
01D4C024	AND	T8,T6,S4
170001AC	BNEZ	T8,7F004AFC	//skip if killflags present
02402825	OR	A1,S2,R0	//A1=S2=address of object
0FC009CE	JAL	7F002738	//specific parsing code for weapons
02603025	OR	A2,S3,R0
//7F004458:
100001A8	BEQ	R0,R0,7F004AFC
00000000	NOP
//7F004460:
...	;blank through 7F004460 to 7F00449C
//7F00449C

7F002738:	37268	08 weapon handler
	accepts: 
27BDFFD8	ADDIU	SP,SP,FFD8
AFBF0014	SW	RA,0014 (SP)
AFA40028	SW	A0,0028 (SP)	;SP+28= ?
AFA5002C	SW	A1,002C (SP)	;SP+2C=p->object
AFA60030	SW	A2,0030 (SP)	;SP+30= ?
8CAE0008	LW	T6,0008 (A1)	//T6=high bitfield
00A03825	OR	A3,A1,R0	//A3=A1=object data address
31CF4000	ANDI	T7,T6,4000
51E00026	*BEQL	T7,R0,7F0027F4	//branch if not assigned to a guard
24050001	ADDIU	A1,R0,0001	//A1=1

//7F002760:	weapon attached to guard
0FC08BF2	JAL	7F022FC8	;V0= p->guard A0 if present
84A40006	LH	A0,0006 (A1)	//A0=preset, or in this case guard ID
8FA7002C	LW	A3,002C (SP)	//A3=object data address
10400064	*BEQ	V0,R0,7F0028E8	;branch if guard invalid
AFA2001C	SW	V0,001C (SP)	;SP+1C=p->GUARDdata
8C580018	LW	T8,0018 (V0)	;T8=p->guard's position data
13000061	*BEQ	T8,R0,7F0028E8	;branch if NULL pointer
8C59001C	LW	T9,001C (V0)	;T9=p->guard's model data handle
1320005F	*BEQ	T9,R0,7F0028E8	;branch if NULL pointer
2404001C	ADDIU	A0,R0,001C	//A0=1C
0FC249EF	JAL	7F0927BC
AFA7002C	SW	A3,002C (SP)
//7F002798:	error handler for stupid model issues
1040000E	*BEQ	V0,R0,7F0027E0
8FA7002C	LW	A3,002C (SP)
80E80080	LB	T0,0080 (A3)	;T0=weapon type
2509FFFE	ADDIU	T1,T0,FFFE	;T1=weapons 2-1F
2D210016	*SLTIU	AT,T1,0016
14200003	*BNEZ	AT,R0,7F0027C8	;branch if a gadget that falls outside range
2529FFE5	*ADDIU	T1,T1,FFE5	;T1-=0x1B
2D210003	*SLTIU	AT,T1,0003
10200006	*BEQ	AT,R0,7F0027E0	;branch if a gadget that falls outside range
	*NOP
	*NOP
	NOP
//7F0027C8:	set weapon as a stock grenade - all but RLS GL gren, prox, timed
240A0019	ADDIU	T2,R0,0019
240B00D3	ADDIU	T3,R0,00D3
240C0100	ADDIU	T4,R0,0100
A0EA0080	SB	T2,0080 (A3)	//set weapon as grenade
A4EB0004	SH	T3,0004 (A3)	//set model as grenade
A4EC0000	SH	T4,0000 (A3)	//set scale=100%
//7F0027E0:
0FC015C4	JAL	7F005710
80E40080	LB	A0,0080 (A3)	//A0=weapon type
8FA4002C	LW	A0,002C (SP)	//A0=object data address
0FC1480C	JAL	7F052030
8FA5001C	LW	A1,001C (SP)
1000003D	*BEQ	R0,R0,7F0028E8
00000000	*NOP
	
//7F0027F4:	0x37320-E	MP expansion handling - REVISED so sets work in solo as well ;*)
;0FC26919	JAL	7F09A464	//RETURNS V0=# players
;AFA50018	SW	A1,0018 (SP)	;TRUE = load weapon by default
;3C018007	LUI	AT,8007
;2442FFFF	*ADDIU	V0,V0,FFFF	//MP>0
;1C400025	*BGTZ	V0,7F0028A0	//skip MP weapon expansion if solo
;AC209540	*SW	R0,9540 (AT)	//0->80069540	ammo box MP type register
;90E40080	*LBU	A0,0080 (A3)	//A0=type
;28810059	SLTI	AT,A0,0059	//tests if weapon is valid (<59)
;14200021	BNEZ	AT,7F0028A0	;if a normal type, jump to flag test after MP stuff
;00000000	*NOP
AFA50018	SW	A1,0018 (SP)	;TRUE = load weapon by default
3C188007	LUI	T8,8007
AF009540	*SW	R0,9540 (T8)	//0->80069540	ammo box MP type register
90E40080	*LBU	A0,0080 (A3)	//A0=type
28810059	SLTI	AT,A0,0059	//tests if weapon is valid (<59)
14200024	BNEZ	AT,7F002898	;if a normal type, jump to flag test after MP stuff
90E10008	*LBU	AT,0008 (A3)	;AT=register for left:right weapon
//7F00280C:	this only applies to MP weapons -figure out type
0FC1A4FD	JAL	7F0693F4	;returns V0=p->MP weapon data
34210010	*ORI	AT,AT,0010	;premptively toggle left-hand flag	TO DISABLE LEFT HANDS, SET THIS TO 0
//7F002814:	oops!  forgot to determine lefties!
30850080	*ANDI	A1,A0,0080	;data# & 80 indicates if left or right
90440003	*LBU	A0,0003 (V0)	;A0=MPdata L-capable flag
00852824	*AND	A1,A0,A1	;If both are set, southpaw
54A00001	*BNEZL	A1,+1
A0E10008	*SB	AT,0008 (A3)	;saves left-handed register
//7F002828:	3735C	if inf. ammo activated, force no boxes and weapon pickups!
930596AB	*LBU	A1,96AB (T8)	;INF AMMO FLAG
14A00005	*BNEZ	A1,7F002844
//7F002830:	37364	test the weapon pickup flag
30850001	*ANDI	A1,A0,0001
AFA50018	*SW	A1,0018 (SP)
//7F002838:	3736C	test the ammo pickup flag
30850002	*ANDI	A1,A0,0002
54A00001	*BNEZL	A1,+1
AF029540	SW	V0,9540 (T8)	//MP weapon data pointer->80069540	used by ammo box to determine MP ammo for weapon
//7F002828:	3735C	if MwtGX, force -boxes, +pickups if only boxes
;30810002	*ANDI	AT,A0,0002
;1020000B	*BEQ	AT,R0,+1	;branch if -boxes
;00052840	SLL	A1,A1,0x1	;sets box and wep flags into same bit
;10250008	BEQ	AT,A1,7F002840	;if both set, it isn't a pickup only type
;90E10080	LBU	AT,0080 (A3)	;A1=type
;240500F7	ADDIU	A1,R0,00F7
;14250005	BNE	AT,A1,7F002840	;branch if not scenario weapon
;3C018003	LUI	AT,8003
;8C21B540	LW	AT,B540 (AT)	;AT=8002B540: scenario
;24050003	ADDIU	A1,R0,0003
;50250002	BEQL	AT,A1,+2	;if MwtGX, force pickup only if no box
;AFA50018	*SW	A1,0018 (SP)	;that's nonzero, so it should work
;AF029540	SW	V0,9540 (T8)	//MP weapon data pointer->80069540	used by ammo box to determine MP ammo for weapon
//7F002844:	mod the model
94450004	*LHU	A1,0004 (V0)	//T9=model type
A4E50004	*SH	A1,0004 (A3)	//change model type
//7F00284C:	weapon type - use BA routine if = -1
80450000	*LB	A1,0000 (V0)	//T8=weapon type
2404FFFF	*ADDIU	A0,R0,FFFF
5485000A	*BNEL	A0,A1,+A
A0E50080	*SB	A1,0080 (A3)	//change object's weapon type to literal
//7F00285C:	alter weapon into Body Armor
AF009540	*SW	R0,9540 (T8)	;make certain no boxes will appear!
24010015	*ADDIU	AT,R0,0015
A0E10003	*SB	AT,0003 (A3)	;set type to 15 (BA)
94410006	*LHU	AT,0006 (V0)
00010A00	*SLL	AT,AT,0x8
ACE10080	*SW	AT,0080 (A3)	;change 2-byte scale to 4-byte armor percentage
8FBF0014	LW	RA,0014 (SP)
1000001A	*BEQ	R0,R0,7F0028EC	;return with a jump into the body armor handler
27FF0178	*ADDIU	RA,RA,0178	;difference between return and BA no armor tests
//7F002880:	scale modifier
944F0006	*LHU	T7,0006 (V0)	;T7=scale mod
94E50000	*LHU	A1,0000 (A3)	;T1=cur scale
00AF0019	*MULTU	A1,T7
00002812	*MFLO	A1
00052A02	*SRL	A1,A1,0x8	;T1=(cur*mod)/0x100
A4E50000	SH	A1,0000 (A3)	//scale->header

//7F002898:	373CC	Solo + Multi - determine if item is a flag!
90E40080	*LBU	A0,0080 (A3)	//A0=type
24010058	ADDIU	AT,R0,0058
14810005	*BNE	A0,AT,+5	//branch if not flag
24010002	ADDIU	AT,R0,0002	;AT=scenario code for flag tag
//7F0028A8:	Flag Handler - this may change when scenarios are altered...
0FC051D6	JAL	7F014758	//returns V0=8002B540=scenario
00000000	*NOP
54410001	*BNEL	V0,AT,+1	;if the scenario isn't set, fry the pickup
AFA00018	*SW	R0,0018 (SP)	;come to think of it, should probably fry ammo as well...
	
//7F0028B8:	373E8	generic weapon expansion - SOLO and MP
10800009	*BEQ	A0,R0,7F0028E8	//skip if type 0
8FA50018	LW	A1,0018 (SP)
10A00007	*BEQ	A1,R0,7F0028E8	//skip if no pickup
00000000	*NOP
0FC015C4	JAL	7F005710	//sets throwable models. returns V0=1 loaded model
00000000	*NOP
8FA40028	LW	A0,0028 (SP)
8FA5002C	LW	A1,002C (SP)	//A1=object offset
0FC00767	JAL	7F001D9C	//expand object
8FA60030	LW	A2,0030 (SP)
	
//7F0028E0:	37410	joint return function
8FBF0014	LW	RA,0014 (SP)
03E00008	JR	RA
27BD0028	ADDIU	SP,SP,0028

00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP

@_@

Ammo boxes and ammo attributement
solo and multi both will use the buffer and model override enabled
if !=0, assumes there's ammo to dump into the thing
	then do the normal test for stuff, and quit out.
Also, if ammo on type found, test its model.
	If model not -1, replace the model code of the object!

7F004760:	39290	primary expansion routine
13C000E6	BEQ	S8,R0,7F004AFC	//generic objects appear flag test
8E44000C	*LW	A0,000C (S2)	//second 32bit flagfield
00942024	*AND	A0,A0,S4
148000E3	*BNEZ	A0,7F004AFC	//test if killflags present
//7F004770:	MP ammo attribument - test if any boxes
3C0E8007	LUI	T6,8007
8DC39540	LW	V1,9540 (T6)	//T6=80069540	last MP weapon# or 0
;1060000B	*BEQ	V1,R0,7F0047A8
1060000C	*BEQ	V1,R0,7F0047A8
24100000	ADDIU	S0,R0,0000	//ammo boxes DO NOT appear by default

//7F004780:	MP ammo attribument - test if any boxes
;strike this - weapons already test for this!
;90640003	*LBU	A0,0003 (V1)	//A0=ammo type
;30840002	*ANDI	A0,A0,0002
;10800007	*BEQ	A0,R0,7F0047A8
//7F00478C:	MP ammo attribument
90640001	*LBU	A0,0001 (V1)	//A0=ammo type
;inserted!  test if < 1B	(1-1A)
2C82001B	*SLTIU	V0,A0,001B	;V0=1 if A0 1-1A - writable
10400008	*BEQ	V0,R0,+8	;do not write ammo if it can't fit in object!
2C82000E	*SLTIU	V0,A0,000E	;V0=1 if A0 1-D
50400001	*BEQL	V0,R0,+1
2484FFF3	*ADDIU	A0,A0,FFF3	;if > D, subtract D
00042080	*SLL	A0,A0,0x2	;A0*=4
00442021	*ADDU	A0,V0,A0	;A0=offset +1 if 1-D
02442021	*ADDU	A0,S2,A0	;A0=p->obj+offset to data
90620002	*LBU	V0,0002 (V1)	;V0=ammo type
A082007D	*SB	V0,007D (A0)	;ammo -> slot

//7F0047A8:	set up a loop through the ammo; assumes S6=-1
2644007C	*ADDIU	A0,S2,007C	;A0=object's ammo offset
264500B0	*ADDIU	A1,S2,00B0	;A1=termination point!
//7F0047B0:	loop: read ammo.  If none, continue.  If some, test if model then break
10850007	*BEQ	A0,A1,7F0047D0
24840004	*ADDIU	A0,A0,0004
94820002	*LHU	V0,0002 (A0)	;V0=2 ammo registers
1040FFFC	BEQ	V0,R0,-4
00508021	*ADDU	S0,V0,S0	;S0+=ammo, to determine if it should appear
84820000	*LH	V0,0000 (A0)	;V0=2 ammo registers
04430001	*BGEZL	V0,+1
A6420004	*SH	V0,0004 (S2)
//7F0047D0:	test if any ammo actually assigned.  Only load model if so
120000C9	*BEQ	S0,R0,7F004AFC
02A02025	OR	A0,S5,R0
02402825	OR	A1,S2,R0
0FC00767	JAL	7F001D9C	//expand object
02603025	OR	A2,S3,R0
100000C4	BEQ	R0,R0,7F004AFC
00000000	*NOP
//7F0047EC:
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	NOP

|_|

Ammo Clips, same as the boxes!
redirecting to 7F004468!	38F98
8FA80278	LW	T0,0278 (SP)
110001A3	BEQ	T0,R0,7F004AFC
02A02025	OR	A0,S5,R0
8E49000C	LW	T1,000C (S2)
0134C824	AND	T9,T1,S4
1720019F	BNEZ	T9,7F004AFC
02402825	OR	A1,S2,R0
0FC00A87	JAL	7F002A1C
02603025	OR	A2,S3,R0
0FC00767	*JAL	7F001D9C
00000000	NOP
10000199	BEQ	R0,R0,7F004AFC
00000000	NOP

7F002A1C:	3754C	revised to set clip ammo
3C028007	*LUI	V0,8007
8C429540	*LW	V0,9540 (V0)
50400002	*BEQL	V0,R0,+2	;well, doesn't need to be likely, but cleaner code this way
92420083	*LBU	V0,0083 (S2)
90420001	*LBU	V0,0001 (V0)
03E00008	JR	RA
A2420083	*SB	V0,0083 (S2)
00000000	*NOP


^_^

body armor expansion update in seperate doc

^_^

Ammo box reading routine update, to attribute ammo properly to players!
//7F050980:	854B0	ammo box collectability
24010014	ADDIU	AT,R0,0014
1441002C	BNE	V0,AT,7F050A38	;if object isn't an ammo box, try BA instead
8FA90088	LW	T1,0088 (SP)
//7F05098C:	test if the thing is even collectable...
8D2A0004	LW	T2,0004 (T1)	;T2=p->obj.data	(T1=obj.pos data in 8006)
240B0001	ADDIU	T3,R0,0001
AFAB006C	SW	T3,006C (SP)	;SP+6C= 1
00A02025	OR	A0,A1,R0	;A0=A1: p->obj.data
0FC0FFF0	JAL	7F03FFC0	;ret V0!=0 if object was destroyed
AFAA0070	SW	T2,0070 (SP)	;SP+70= p->obj.data
//7F0509A4:
14400016	*BNEZ	V0,7F050A00	;branch if destroyed
8FA30070	LW	V1,0070 (SP)	;V1=p->obj.data
//7F0509AC:	854DC	initialize loop if object valid
00002025	*OR	A0,R0,R0	;V0=0	current ammo type -1
//7F0509B0:	854E0	correct for second line of stuff...
24840001	*ADDIU	A0,A0,0001	;A1=V0+1	next type
2401000E	*ADDIU	AT,R0,000E	;AT=E	this is when it loops back on itself
50810001	*BEQL	A0,AT,+1	;redirect ammo type 2 to 1
2463FFCB	*ADDIU	V1,V1,FFCB	;subtract -0x35 from thing to get second set of ammo types
//7F0509C0:	854F0	read ammo type and compare to maximum for that type
906C0083	*LBU	T4,0083 (V1)	;T4=ammo for type
11800008	*BEQ	T4,R0,7F0509E8	;if no ammo (or stupid ammo), loopus
00000000	*NOP
0FC1A490	JAL	7F069240	;ret V0=player's total ammo of type A0; fries T6,T7,T8
00000000	*NOP
0FC1A4B5	JAL	7F0692D4	;ret V0=max ammo for type A0; fries T6
00023025	*OR	A2,V0,R0	;A2= stock
00C2082A	SLT	AT,A2,V0	;AT=TRUE if stock<max
54200004	*BNEZL	AT,7F050A24	;branch if you already had enough stuff
AFA0006C	SW	R0,006C (SP)	;SP+6C= 0
//7F0509E8:	loop for all types
2401001A	*ADDIU	AT,R0,001A	;AT=D: total number of ammo types in a box
1481FFF0	*BNE	A0,AT,7F0509B0
24630004	ADDIU	V1,V1,0004	;V1+=4: p->next ammo type in obj.
//7F0509F4:	test collectability
8FAD006C	LW	T5,006C (SP)	;T5=0 if collectable, 1 if not
11A0003E	BEQ	T5,R0,7F050AF0	;branch if collectable
00000000	*NOP
//7F050A00:	85530
100000BB	BEQ	R0,R0,7F050D20	;quit otherwise
00001025	OR	V0,R0,R0	;V0=0
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	NOP
//7F050A38:	85568	body armor collectability
24010015	ADDIU	AT,R0,0015
1441002C	BNE	V0,AT,7F050AF0
8FAE0088	LW	T6,0088 (SP)
	...

$_$

otherhalf of ammo crate work - forcing it to spew forth more types

7F050338:	84E68	collect ammo crate
00002025	*OR	A0,R0,R0	;cur=0
00608025	OR	S0,V1,R0	;S0=V1: p->obj.data
//7F050340:	84E70	correct for rollaround
24840001	*ADDIU	A0,A0,0001	;V1=cur+1	type
2401000E	*ADDIU	AT,R0,000E	;rollaround at type E
50810001	*BEQL	A0,AT,+1	;if they match, subtract the buffer difference
2610FFCB	*ADDIU	S0,S0,FFCB	;start back over at 0x82
//7F050350:	84E80	retrieve ammo total for current type
0FC26919	JAL	7F09A464	;ret V0=# players; fries V0,V1,T6,T7,T8,T9
92050083	*LBU	A1,0083 (S0)	;A1=ammo from object
24010001	ADDIU	AT,R0,0001
14410008	*BNE	V0,AT,7F050380	;branch if multi
AFA40020	*SW	A0,0020 (SP)	;SP+4C= ammo type
//7F050364:	84E94	solo only: ammo multiplier
44852000	MTC1	A1,F4		;F4=ammo
3C018003	LUI	AT,8003
C4280B28	LWC1	F8,0B28 (AT)	;F8=80030B28: 1.0
468021A0	CVT.S.W	F6,F4
46083282	MUL.S	F10,F6,F8
4600540D	TRUNC.W.S	F16,F10
44058000	MFC1	A1,F16		;A1=new ammo total
//7F050380:	84EB0	attribute the ammo!
00003025	OR	A2,R0,R0	;A2=0	no sound effect on ammo collection
0FC13E9A	JAL	7F04FA68	;add the ammo to player's inventory
8FA70074	LW	A3,0074 (SP)	;A3=text display attribute (1 usually)
8FA40020	LW	A0,0020 (SP)	;V0=actual type
2401001A	ADDIU	AT,R0,001A	;AT=1A	ammo boxes now hold 1-1A ammo
1481FFEA	*BNE	A0,AT,7F050340	;branch if more types
26100004	ADDIU	S0,S0,0004	;S0+=4	next ammo slot
//7F05039C:	84ECC	play collection sound effect
3C048006	LUI	A0,8006
8C843720	LW	A0,3720 (A0)	;A0=80063720: buffer
240500EA	ADDIU	A1,R0,00EA	;A1=SE 0EA
0C002382	JAL	70008E08	;play sound 0EA
00003025	OR	A2,R0,R0	;A2=0
100000B0	BEQ	R0,R0,7F050674	;all done
24030001	ADDIU	V1,R0,0001	;V1=1
//7F0503B8	84EE8
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	NOP

(_)

A smart person would have linked something in to actually copy the random weapon set code...
0FC14282 copies set number to cur and handles random weapon sets
fries: AT,A0,A1,A2,V0,T6,T7

start from MP menu = 7F010D7C
7F01AE6C	handles jump to stage
	AE7C	set return from demos	(legal screen)
	AEA4	set return from MP	(MP options)
	AEC8	set return from cuba	(actors)
	AEE4	set return from solo	(mission failed)
	
best bet would be to insert it into the stage initializer - just do it all the time
granted, it is used more than once during stage initialization, but that won't affect this.  Not one bit

DIMINISHING THIS MORE THAN NECESSARY TO LEAVE ROOM FOR FUTURE INSERTIONS

7F001750:	36280	stage multiplier initialization
27BDFFE8	ADDIU	SP,SP,FFE8
AFBF0014	SW	RA,0014 (SP)
0FC00656	JAL	7F001958
00000000	NOP
0FC006C2	JAL	7F001B08
00000000	NOP
//7F001768:	36298
0FC14282	*JAL	7F050A08	;MP selected set to cur + set random
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
3C018003	LUI	AT,8003
24250034	ADDIU	A1,AT,0034
AC200AC0	SW	R0,0AC0 (AT)
1425FFFE	BNE	AT,A1,-2
24210004	ADDIU	AT,AT,0004
24050001	ADDIU	A1,R0,0001
AC250AB0	SW	A1,0AB0 (AT)	;1->80030AE8
3C028007	LUI	V0,8007
24432E70	*ADDIU	V1,V0,2E70
24421E80	ADDIU	V0,V0,1E80
//7F0017EC:	3631C
...

!_!

ammo on object collection
replacing TLB jumps with a table
80053060 - 800530D0	0x322D0 - 32340

REWRITE REQUIRES REMAPPING 7F04FCF8 -> 7F04FC4C	0FC13F3E -> 0FC13F13

7F04FC3C	8476C	V0= amount of ammo received from 07 clip object
	accepts: A0=p->obj.data
27BDFFE0	ADDIU	SP,SP,FFE0
AFBF0014	SW	RA,0014 (SP)
10000009	*BEQ	R0,R0,7F04FC6C
90820083	*LBU	V0,0083 (A0)	;T6=ammo type
//7F04FC4C:	the old 7F04FCF8 - 08 objects
27BDFFE0	ADDIU	SP,SP,FFE0
AFBF0014	SW	RA,0014 (SP)
8C820008	*LW	V0,0008 (A0)	;T8=object bitflags upper word
00021040	*SLL	V0,V0,0x1
04420015	*BLTZL	V0,7F04FCB4 	;branch if 0x40000000 not set
00001025	OR	V0,R0,R0
0FC1A50B	JAL	7F06942C	;ret V0= ammo type for weapon A0
80840080	LB	A0,0080 (A0)	;A0= weapon type
//7F04FC6C:	shared routine
2C41001E	*SLTIU	AT,V0,001E
50200010	*BEQL	AT,R0,7F04FCB4
00001025	*OR	V0,R0,R0
3C018005	LUI	AT,8005
00220821	*ADDU	AT,AT,V0
9022305F	*LBU	V0,305F (AT)	;maps type 1 to 80053060
//7F04FC84:	skip multipliers if 0-1 ammo
24010001	*ADDIU	AT,R0,0001
1022000A	BEQ	AT,V0,7F04FCB4	;quit if only 0-1 ammo present
//7F04FC8C:	test multiplayer
3C038003	*LUI	V1,8003
8063A8F3	*LB	V1,V1,A8F3
10610007	BEQ	V1,AT,7F04FCB4	;branch if multiplayer
//7F04FC98:	solo ammo multiplier
3C018003	LUI	AT,8003
44822000	MTC1	V0,F4
C4280B28	LWC1	F8,0B28 (AT)	;F8=80030B28: ammo multiplier
468021A0	CVT.S.W	F6,F4	;F6= (float) ammo
46083282	MUL.S	F10,F6,F8	;F10= ammo * mult
4600540D	TRUNC.W.S	F16,F10
44028000	MFC1	V0,F16		;V1=new ammo
//7F04FCB4:	return
8FBF0014	LW	RA,0014 (SP)
03E00008	JR	RA
27BD0020	ADDIU	SP,SP,0020
//7F04FC70:	type 1
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	NOP

7F04FCF8	V0= amount of ammo received from 08 item object
	accepts: A0=p->obj.data
27BDFFE0	ADDIU	SP,SP,FFE0
AFBF0014	SW	RA,0014 (SP)
8C820008	*LW	V0,0008 (A0)	;T8=object bitflags upper word
00021040	*SLL	V0,V0,0x1
044200??	*BLTZL	V0,+end 	;branch if 0x40000000 not set
00001025	OR	V0,R0,R0
0FC1A50B	JAL	7F06942C	;ret V0= ammo type for weapon A0
80840080	LW	A0,0080 (A0)	;A0= weapon type
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	*NOP
00000000	NOP
00000000	*NOP
//7F04FD34:	jump to specific ammo routine
10200015	BEQ	AT,R0,7F04FD8C	;skip if aboe type E
00084080	SLL	T0,T0,0x2
3C018005	LUI	AT,8005
00280821	ADDU	AT,AT,T0	;AT=type -> offest
8C283098	LW	T0,3098 (AT)	;T0=8005308+offset: TLB jump for each type
01000008	JR	T0
00000000	NOP
//7F04FD50:	type 1
1000000E	BEQ	R0,R0,7F04FD8C
2403000A	ADDIU	V1,R0,000A
//7F04FD58:	type 2
1000000C	BEQ	R0,R0,7F04FD8C
2403000A	ADDIU	V1,R0,000A
//7F04FD60:	type 3
1000000A	BEQ	R0,R0,7F04FD8C
2403000A	ADDIU	V1,R0,000A
//7F04FD68:	type 4
10000008	BEQ	R0,R0,7F04FD8C
24030005	ADDIU	V1,R0,0005
//7F04FD70:	type C
10000006	BEQ	R0,R0,7F04FD8C
24030005	ADDIU	V1,R0,0005
//7F04FD78:	type D
10000004	BEQ	R0,R0,7F04FD8C
24030003	ADDIU	V1,R0,0003
//7F04FD80:	type E
10000002	BEQ	R0,R0,7F04FD8C
24030004	ADDIU	V1,R0,0004
//7F04FD88:	type B
24030003	ADDIU	V1,R0,0003
//7F04FD8C:	test amount of ammo
28610002	SLTI	AT,V1,0002
5420000F	BNEL	AT,R0,7F04FDD0	;quit if 0 or 1 ammo received
00601025	OR	V0,V1,R0
//7F04FD98:	determine if multiplayer
0FC26919	JAL	7F09A464	;ret V0=# players
AFA30018	SW	V1,0018 (SP)	;SP+18= ammo
24010001	ADDIU	AT,R0,0001
14410009	BNE	V0,AT,7F04FDCC	;branch if multi
8FA30018	LW	V1,0018 (SP)	;V1= ammo
//7F04FDAC:	solo ammo multiplier
44832000	MTC1	V1,F4
3C018003	LUI	AT,8003
C4280B28	LWC1	F8,0B28 (AT)	;F8=80030B28: ammo multiplier
468021A0	CVT.S.W	F6,F4	;F6= (float) ammo
46083282	MUL.S	F10,F6,F8	;F10= ammo * mult
4600540D	TRUNC.W.S	F16,F10
44038000	MFC1	V1,F16		;V1=new ammo
00000000	NOP
//7F04FDCC:	return
00601025	OR	V0,V1,R0	;V0=V1: ammo
8FBF0014	LW	RA,0014 (SP)
27BD0020	ADDIU	SP,SP,0020
03E00008	JR	RA
00000000	NOP
//7F04FDE0:	84910

[_]	The amazing, the stunning, "Casino Royale"!

Completely random set generator
generates 8 weapons, then sets doubles in upper set
rand % cap, +1
This produces values from 1-cap, which should all be valid numbers - nothing slot

place as set 1	80048A52; inject in setup thingy, just after random

7F082BD0	B7700	0FC20AF4	generates random weapons for set
	manually rigged to overwrite set 1
	fries: AT,A0,A1,A2,V0,T6,T7,T8
AFBFFFE0	SW	RA,FFE0 (SP)
3C0E8005	LUI	T6,8005
25D80007	ADDIU	T8,0007 (T6)	;endpoint
91CF9161	LBU	T7,9161 (T6)	;T7=selected
0C002914	JAL	7000A450	;fries AT,A0,A1,A2,V0
25CE0001	ADDIU	T6,T6,0001	;next slot
004F001B	DIVU	V0,T7
00001010	MFHI	V0		;T8=set % total
24420001	ADDIU	V0,V0,0001	;gets knives - tank
A1C28A51	SB	V0,8A51 (T6)	
34420080	ORI	V0,V0,0080	;double if possible
55D8FFF8	BNEL	T6,T8,-8
A1C28A59	SB	V0,8A59 (T6)
24020025	ADDIU	V0,R0,0025	;V0=BA
8FBFFFE0	LW	RA,FFE0 (SP)
03E00008	JR	RA
A1C28A59	SB	V0,8A59 (T6)

recoded in MwtGX

~_~


#_#	miscellaneous other mods integrated in patch

set tank cannon to use type 2
should now allow type 2 at ammo collection

propobjE.txt
should display "Picked up a cannon"
A434	"a flare pistol."	->	"a tazer."
A438	"a piton gun."	->	"a cannon."
insert one for "a gadget."	used for watch laser and attract


+.+

revised to use a table of indices to short values
80052FEC:	1 nibble each
01411442 22311111 21112212 55060100

80052FFC:
00EA	firearm
00EB	mine
00E9	knife
002D	!new! rockets and grenades
0064	!new! watch laser and magnet pickup
00F4	!new! film


7F04F788	0x842B8	plays sound of ammo type collection
	accepts: A0=ammo type
27BDFFE8	ADDIU	SP,SP,FFE8
AFBF0014	SW	RA,0014 (SP)
00047042	*SRL	T6,A0,0x1	;T6=type/2
30810001	*ANDI	AT,A0,0001	;AT=TRUE if no need to push
3C048005	*LUI	A0,8005
008E7021	*ADDU	T6,A0,T6
91CE2FEC	*LBU	T6,2FEC (T6)	;byte containing the nibble
50200001	*BEQL	AT,R0,+1	;if first nibble, move it
000E7102	*SRL	T6,T6,0x4	;A0=upper nibble
31CE000F	*ANDI	T6,T6,000F	;one nibble only
11C00007	*BEQ	T6,R0,+return	;branch if no sound
000E7040	*SLL	T6,T6,0x1	;T6*2=offset in sound table
008E2021	*ADDU	A0,A0,T6
94852FFA	*LHU	A1,2FFA (A0)	;A1=sound
//7F04F7BC:	0x842E8	play sound
3C048006	LUI	A0,8006
8C843720	LW	A0,3720 (A0)
0C002382	JAL	70008E08
00003025	OR	A2,R0,R0
//7F04F7CC:	0x842F8	return
8FBF0014	LW	RA,0014 (SP)
03E00008	JR	RA
27BD0018	ADDIU	SP,SP,0018
//7F04F7D8:
00000000	NOP
00000000	NOP
00000000	NOP
00000000	NOP
00000000	NOP
00000000	NOP
00000000	NOP
00000000	NOP
00000000	NOP
00000000	NOP
00000000	NOP
00000000	NOP
00000000	NOP
//7F04F808:	0x84338	...


